﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using LMKJ.Classes;

namespace LMKJ
{
    public partial class searchshoppinglists : System.Web.UI.Page
    {
        private static ArrayList shoppinglistList = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                shoppinglistList = DatabaseManager.RetrieveAllShoppingList();

                shoppinglistDlist.DataSource = shoppinglistList;
                shoppinglistDlist.DataBind();
            }
        }

        protected void searchBtn_Click(object sender, EventArgs e)
        {
            shoppinglistList.Clear();
            shoppinglistList.Add(DatabaseManager.RetrieveShoppingListById(Convert.ToInt32(searchTbx.Text)));

            shoppinglistDlist.DataSource = shoppinglistList;
            shoppinglistDlist.DataBind();
        }

        protected void showAllBtn_Click(object sender, EventArgs e)
        {
            shoppinglistList = DatabaseManager.RetrieveAllShoppingList();

            shoppinglistDlist.DataSource = shoppinglistList;
            shoppinglistDlist.DataBind();
        }

    }
}